/*
 * FielAction.java
 *
 * Created on 8 de diciembre de 2005, 17:27
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package org.fiel.admin.struts.actions;

import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;

import org.fiel.FielConstants;
import org.fiel.login.FielPrincipal;

import org.apache.struts.actions.DispatchAction;

/**
 * @author Luis Pablo Gallo (luispablo.gallo@gmail.com)
 */
public class FielAction extends DispatchAction{

    protected String authorize  ( HttpServletRequest request
                                , String target ){
        
        if( request.getAttribute(FielConstants.STRUTS_GLOBAL_ERROR)!=null ){
            ActionErrors errors = new ActionErrors();
            errors.add(FielConstants.STRUTS_GLOBAL_ERROR, new ActionError(FielConstants.ERROR_EXCEPTION));
            errors.add(FielConstants.STRUTS_GLOBAL_ERROR, new ActionError(FielConstants.ERROR_DETAIL, request.getAttribute(FielConstants.STRUTS_GLOBAL_ERROR)));
            this.saveErrors(request, errors);
            
            return FielConstants.FAILED;
        }else{
            return target;
        }
           
    }
    
}